﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>使用onerror事件处理错误</title>
    <script>
        window.onerror = function (sMessage, sUrl, sLine) {
            alert("出错了！\n" + sMessage + "\nUrl：" + sUrl + "\n出错行：" + sLine);
            return true;    //屏蔽系统事件
        }
    </script>
</head>
<body onload="aa();">

</body>
</html>